//edit页面使用begin ===========================================================
var params = {};
var current = {};
var defaultPageSize = 10;
var currentPage = 1;
var pageSize = defaultPageSize;
var option = {};

// 编辑入口
$(function() {
	var id = localStorage.getItem("rowId");
	localStorage.removeItem("rowId");
	getEntityById(id);
	$('.add').on('click', updateEntity);
	$('.empty').on('click', cancel);

	$("#storageManagerQuery").bind('click', function() {
		employeeQuery('#employeeNameLov');
	});
	$("#storageManagerName").bind('click', function() {
		lovEmployee('storageManager');
	});
});

var seq = 1;
function getEntityById(id) {
	$.ajax({
		url : webUrl + 'storage/getEntityById.do',
		type : 'post',
		data : {
			id : id
		}
	}).done(function(data) {
		var d = data.bo;
		// 初始化
		$("#storageId").val(d.storageId);
		// $("#lastUpdatedBy").val(d.lastUpdatedBy);
		// $("#createdBy").val(d.createdBy);
		// $('#createdDate').datetimebox('setValue',
		// formatDate(new Date(d.createdDate)));
		// $('#lastUpdatedDate').datetimebox('setValue',
		// formatDate(new Date(d.lastUpdatedDate)));
		// $("#enabledFlag").val(d.enabledFlag);
		// $("#status").val(d.status);
		// alert(JSON.stringify(d.remark));
		if (d.storageName != null) {
			$("#storageName").val(d.storageName);
		}
		if (d.storageAddress != null) {
			$("#storageAddress").val(d.storageAddress);
		}
		if (d.locator != null) {
			$("#locator").val(d.locator);
		}
		if (d.storageManager != null) {
			$("#storageManager").val(d.storageManager);
		}
		if (d.storageManagerName != null) {
			$("#storageManagerName").val(d.storageManagerName);
		}
		if (d.remark != null) {
			$("#remark").val(d.remark);
		}
	});
}
function cancel() {
	$('.main_panel').load(webUrl + "public/page/storage/query.html");
}
// edit页面使用end =============================================================
